package com.prs.crm.action.sale.flow;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;

import com.prs.crm.action.FlowAction;
import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.sale.Returns;
import com.prs.crm.domain.sale.SalesContract;
import com.prs.crm.service.sale.ReturnsService;
import com.prs.crm.service.sale.SalesContractService;

public class ReturnsFlowAction extends FlowAction<Returns> {
	
	private Returns returns;
	private ReturnsService returnsService;	
	private PaginationSupport pagination;
	
	
	@Action("listReturnsFlow")
	public String listReturnsFlow() {
		pagination = this.getPaginationHelper().prepare(pagination);
		pagination = this.getReturnsService().listFlowTask(Returns.class, pagination, AppContext.getAccountContext().currentUser());
		return SUCCESS;
	}
	
	@Action("editReturnsFlow")
	public String editReturnsFlow() {
		this.displayEndNodes();		
		return SUCCESS;
	}
	
	@Clew(results={"success"})
	@Action(value="submitReturnsFlow",results={@Result(name="success",type="redirect",location="listReturnsFlow")})
	public String submitReturnsFlow() {
		this.getReturnsService().execute(this.getNode(), this.getDetail(), returns, AppContext.getAccountContext().currentUser());
		this.setPrompt("提交成功");
		return SUCCESS;
	}

	
	
	

	public Returns getReturns() {
		return returns;
	}

	public void setReturns(Returns returns) {
		this.returns = returns;
	}

	public ReturnsService getReturnsService() {
		return returnsService;
	}

	public void setReturnsService(ReturnsService returnsService) {
		this.returnsService = returnsService;
	}

	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	
	
	
	
	
	
	

}
